This tutorial will walk through how to deply the Rock Paper Scissors Neural Network Model trained in the previous tutorial to a Raspi Pico. This is achieved by exporting a C++ library and using it to overwrite a framework project with your own model before compiling and uploading to a Raspi Pico using the built in USB file system drag and drop bootloader.
The Virtual Breadboard SDK for RaspiPi contains projects and frameworks that can be used to program a RaspPi Pico to run Virtual Breadboard application via the EDGEY interface.
git clone https://github.com/virtualbreadboard/vbb-raspi-pico.git
The Virtual Breadboard for RaspiPi SDK has an example which can used to capture the gesture information from VBB via the EDGEY interface already setup for classification
Change directory to the edge-rps example
cd vbb-raspi-pico\tinyML\edge-rps
The project contents should be
Example directory
The ei_rp2040_firmware.uf2 is the end result of the compile process and you can use this file as a short cut. The rest of this tutorial explains how to build it yourself.
The directories edge-impulse-sdk, model-paramters, tflite are exported from your edge impulse deployment process. These folders and their contents we will replace with our own model files in the next step.
A C++ Library model can be deployed as source code to be compiled into your own project. The deployment model contains all the files you need including the tensforflow neural network evaluation engine and the weightings for your trained model ready to go.
To deploy your model:
The idea is to replace the existing edge-impulse-sdk, model-paramters, tflite folders in the project with the folders from the deployed model.
One way to do this is:
The next step is to use the CMMake system to generate build files for the project preparing it to compile. To do this we create a build directory and instuct CMake to scan the project files for CMake directives to create build files for all the projects in the SDK including edge-rps project
>cd ..
>mkdir build
>cd build
>cmake -G "NMake Makefiles" ..
Having created the make files we are not ready to compile the project to create the hex and .uf2 bootloable file.
>cd build
>nmake
Programming the Raspberry Pi Pico can be achieved by dragging and dropping the ei_rp2040_firmware.u2f to the bootloader file system of the Raspberry Pico. When the Pico is connected to the USB port with the reset button pressed the Pico will mount as a USB file system.
To program:
Congratulations you have successfully programmed your Raspberry Pi Pico with your own model. The next step is to test it.